package com.itheima;

import com.alibaba.druid.pool.DruidDataSource;
import com.itheima.dao.BookDao;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;

public class App {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext1.xml");
//        DataSource dataSource = (DataSource) ctx.getBean("dataSource");
//        System.out.println(dataSource);
//
//        BookDao bookDao = (BookDao) ctx.getBean("bookDao");
//        bookDao.save();
        DruidDataSource druidDataSource = (DruidDataSource) ctx.getBean("druidDataSource");
        System.out.println(druidDataSource);
        BookDao bookDao = (BookDao) ctx.getBean("bookDao");
        bookDao.save();
//        ComboPooledDataSource comboPooledDataSource = (ComboPooledDataSource) ctx.getBean("comboPooledDataSource");
//        System.out.println(comboPooledDataSource);

    }
}
